package sgbag1.Vues;

import java.awt.BorderLayout;
import java.awt.Dimension;

import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class TestFrame extends JFrame {
    private BorderLayout borderLayout1 = new BorderLayout();
    private TestPanel jPanel1 = new TestPanel();

    public TestFrame() {
        try {
            jbInit();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    
    public void ajoutVue(VueAeroport v){
        jPanel1.setAeroport(v);
    }
    
    public void redraw(){
        System.out.println("redraw frame");
        jPanel1.repaint();
    }

    private void jbInit() throws Exception {
        this.getContentPane().setLayout(borderLayout1);
        this.setSize( new Dimension(400, 300) );
        this.setTitle( "Just a simple test frame" );
        this.getContentPane().add(jPanel1, BorderLayout.CENTER);
        
        jPanel1.addMouseListener(new MouseAdapter(){
           public void mouseClicked(MouseEvent e) {
             //System.out.println("Click at: " + e.getPoint());
               jPanel1.click(e);
           }
        });
        
    }
    
}
